Skip to content

Conversation

@mkhamoyan
Copy link
Contributor

@mkhamoyan mkhamoyan commented Nov 29, 2022

Add WASI runtime as XHarness target

Copy link
Member

@radical radical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good first draft 👍

using System;
using System.IO;

namespace Microsoft.DotNet.XHarness.CLI.CommandArguments.Wasi;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need to be duplicated, and can be shared by Wasi, and Wasm commands.

radical
radical previously requested changes Dec 7, 2022
Copy link
Member

@radical radical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking much better now! Some more feedback based on trying out the new command.

public WasmEngineArgument Engine { get; } = new();
public WasmEngineLocationArgument EnginePath { get; } = new();
public WasmEngineArguments EngineArgs { get; } = new();
public WasmFileArgument WasmFile { get; } = new("dotnet.wasm");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed. It can be specified as part of the pass through commands. For example:

xharness wasi test -- WasmTestRunner.wasm System.Collections.Tests.dll

All the arguments after -- are pass-through arguments, which will be passed to wasmtime as-is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we could try to add https://wasmedge.org/ engine to see if they have same expectations

@radical
Copy link
Member

radical commented Dec 7, 2022

It would be good to use FindEngineInPath in the test command (#977 (comment)).

@mkhamoyan mkhamoyan requested a review from radical December 8, 2022 15:38
Comment on lines 60 to 61
logger.LogInformation($"Using wasm engine {Arguments.Engine.Value} from path {engineBinary}");
await PrintVersionAsync(Arguments.Engine.Value.Value, engineBinary);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move these inside the try/catch, so a missing engine error can be reported correctly. Do the same for WasmTestCommand.

Comment on lines 126 to 131
if (logProcessor.LineThatMatchedErrorPattern != null)
{
logger.LogError("Application exited with the expected exit code: {result.ExitCode}."
+ $" But found a line matching an error pattern: {logProcessor.LineThatMatchedErrorPattern}");
return ExitCode.APP_CRASH;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed because we are not using a error patterns scanner at all.

var stdoutFilePath = Path.Combine(Arguments.OutputDirectory, "wasi-console.log");
File.Delete(stdoutFilePath);

var logProcessor = new WasmTestMessagesProcessor(xmlResultsFilePath,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value for the last two parameters can be made null now.

Copy link
Member

@radical radical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the few comments, looks good 👍

Copy link
Member

@radical radical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 great job:)

Copy link
Member

@pavelsavara pavelsavara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@premun premun changed the title Xharness wasi Add the WASI runtime test target Dec 14, 2022
@mkhamoyan mkhamoyan marked this pull request as ready for review December 15, 2022 08:06
@mkhamoyan mkhamoyan enabled auto-merge (squash) December 15, 2022 08:14
@mkhamoyan mkhamoyan disabled auto-merge December 15, 2022 08:56
@mkhamoyan mkhamoyan enabled auto-merge (squash) December 15, 2022 08:59
@mkhamoyan mkhamoyan merged commit a54eccd into dotnet:main Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants